﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

using AimGameLibrary;

namespace AimGameEngine.NodeEditorObject
{
    partial class PropretyVector2 : Form
    {
        NodeVector2 nodevector2;
        public PropretyVector2(NodeVector2 nodevector2)
        {
            InitializeComponent();
            this.nodevector2 = nodevector2;
            this.numX.Value = (int)nodevector2.myvector2.X;
            this.numY.Value = (int)nodevector2.myvector2.Y;
            this.InputMode.SelectedItem = nodevector2.InputMode.ToString();

        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            String tempString = (String)this.InputMode.SelectedItem;

            if (tempString != NodeInputMode.None.ToString())
            {
                numX.Enabled = false;
                numY.Enabled = false;
            }
            else
            {
                numX.Enabled = true;
                numY.Enabled = true;
            }
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            String tempString = (String)this.InputMode.SelectedItem;
            String tempOldmode = nodevector2.InputMode.ToString();

            if (tempString == NodeInputMode.Float_2.ToString())
                nodevector2.InputMode = NodeInputMode.Float_2;
            else if (tempString == NodeInputMode.Vector2_1.ToString())
                nodevector2.InputMode = NodeInputMode.Vector2_1;
            else nodevector2.InputMode = NodeInputMode.None;

            if (nodevector2.InputMode == NodeInputMode.None)
                nodevector2.myvector2 = new Microsoft.Xna.Framework.Vector2((float)this.numX.Value,(float)this.numY.Value);

            if (tempOldmode != tempString)
            nodevector2.SetupProprety();
        }
    }
}
